/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.put.netbeans.dcs_modeler.palette;

import java.util.ArrayList;
import org.openide.nodes.Index;
import org.openide.nodes.Node;

/**
 *
 * @author rudy
 */
class WorkflowElementChildren extends Index.ArrayChildren
{

    private Category category;
    private String[][] items = new String[][]
    {
        { "0", "Tools", "org/put/netbeans/dcs_modeler/palette/images/connection.png", "notDnD", "CONNECTION_TOOL" },
        { "1", "Tools", "org/put/netbeans/dcs_modeler/palette/images/arrow.png", "notDnD", "ARROW" },
        { "2", "Workflow", "org/put/netbeans/dcs_modeler/palette/images/workflow_simple_case.png", "DnD", "WORKFLOW_ELEMENT" } ,
    } ;

    public WorkflowElementChildren(Category Category) 
    {
        this.category = Category;
    }

    @Override
    protected java.util.List<Node> initCollection() 
    {
        ArrayList childrenNodes = new ArrayList( items.length );
        for( int i=0; i < items.length; i++ )
        {
            if ( category.getName().equals( items[ i ][ 1 ] ) )
            {
                WorkflowElement item = new WorkflowElement();
                item.setNumber( new Integer( items[ i ][ 0 ] ) );
                item.setCategory( items[ i ][ 1 ] );
                item.setImage( items[ i ][ 2 ] );
                item.setDnd( items[ i ][ 3 ].equals( "DnD" ) );
                item.setElementType( WorkflowElement.ElementType.valueOf( items[ i ][ 4 ] ) );
                childrenNodes.add( new WorkflowElementNode( item ) );
            }
        }
        return childrenNodes;
    }
}
